#include "widget.h"
#include "ui_widget.h"
#include<QPushButton>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    mypushButton=new QPushButton(this);
    mypushButton->setText("Hello World");
    connect(mypushButton,&QPushButton::clicked,this,&Widget::as);
}

void Widget::as()
{
    if(mypushButton->text()=="Hello World")
    {
        mypushButton->setText("Hello QT");
    }
    else
    {
        mypushButton->setText("Hello World");
    }
}

Widget::~Widget()
{
    delete ui;
}

